package com.zy.baselib.annotations

import androidx.annotation.Keep

/**
 * 只支持 字段为String/TextView/EditText以及子类。
 */
@Keep
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FIELD)
annotation class VerifyInput(
        val error: String = "",
        val maxLength: Int = -1,
        val minLength: Int = -1,
        val index: Int = 1,
        val showToast: Boolean = true,
        @VerifyInputType val type: Int = VerifyInputType.TYPE_EMPTY
)

@Keep
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class VerifyInputType {
    companion object {

        /**
         * 非空判断包括空字符串
         */
        const val TYPE_EMPTY = 1

        /**
         * 邮箱判断
         */
        const val TYPE_EMAIL = 2

        /**
         * 中国手机号校验
         */
        const val TYPE_PHONE_CN = 3

        /**
         * 中国身份证号校验
         */
        const val TYPE_ID_CN = 4

        /**
         * 纯中文校验
         */
        const val TYPE_CN = 5

        /**
         * 纯英文校验
         */
        const val TYPE_EN = 6

        /**
         * 纯数字校验
         */
        const val TYPE_NUMBER = 7
    }
}